package tazadum.engine.entity;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;

import tazadum.engine.Entity;
import tazadum.engine.Interval;
import tazadum.engine.math.Vector;

public class SolidBackgroundEntity implements Entity {
	private final Vector background;

	public SolidBackgroundEntity(final Vector background) {
		this.background = background;
	}

	@Override
	public void precalc(final GLAutoDrawable drawable, final float screenRatio) {
	}

	@Override
	public void update(final GLAutoDrawable drawable, final float globalTime, final float localTime, final float dt, final Interval interval) {
		final GL gl = drawable.getGL();

		gl.glClearColor(background.x, background.y, background.z, 1.0f);
		gl.glDepthRangef(0.1f, 1000);
		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
	}
	
	@Override
	public void destroy(final GLAutoDrawable drawable) {
	}	
}
